﻿using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.Text;
using Maticsoft.Common;
using LTP.Accounts.Bus;
namespace MidSoft.Web.Model_T_PET_YEARCHK
{
    public partial class Add : Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
                       
        }

        		protected void btnSave_Click(object sender, EventArgs e)
		{
			
			string strErr="";
			if(this.txtPET_YEARCCK_ID.Text.Trim().Length==0)
			{
				strErr+="ID不能为空！\\n";	
			}
			if(!PageValidate.IsDecimal(txtACCEPT_TYPE.Text))
			{
				strErr+="接收类型。格式错误！\\n";	
			}
			if(this.txtACCEPT_NO.Text.Trim().Length==0)
			{
				strErr+="接收号码。不能为空！\\n";	
			}
			if(!PageValidate.IsDateTime(txtCHARGE_DATE.Text))
			{
				strErr+="收费日期。格式错误！\\n";	
			}
			if(this.txtCHARGER_ID.Text.Trim().Length==0)
			{
				strErr+="收费ID。不能为空！\\n";	
			}
			if(this.txtNOTE.Text.Trim().Length==0)
			{
				strErr+="备注。不能为空！\\n";	
			}
			if(this.txtREG_ORG_ID.Text.Trim().Length==0)
			{
				strErr+="注册机构ID。不能为空！\\n";	
			}
			if(!PageValidate.IsDateTime(txtTAKE_DATE.Text))
			{
				strErr+="处理时间。格式错误！\\n";	
			}
			if(this.txtTAKER_NAME.Text.Trim().Length==0)
			{
				strErr+="处理人。不能为空！\\n";	
			}
			if(this.txtCHARGE_STATE.Text.Trim().Length==0)
			{
				strErr+="收费状态。不能为空！\\n";	
			}
			if(!PageValidate.IsDateTime(txtCREATE_TIME.Text))
			{
				strErr+="创建日期。格式错误！\\n";	
			}
			if(this.txtCREATOR_ID.Text.Trim().Length==0)
			{
				strErr+="创建ID。不能为空！\\n";	
			}
			if(!PageValidate.IsDateTime(txtUPDATE_TIME.Text))
			{
				strErr+="更新日期。格式错误！\\n";	
			}
			if(this.txtUPDATOR_ID.Text.Trim().Length==0)
			{
				strErr+="更新人。不能为空！\\n";	
			}
			if(this.txtCARD_NO.Text.Trim().Length==0)
			{
				strErr+="注册证件号。不能为空！\\n";	
			}
			if(!PageValidate.IsDecimal(txtCARD_TYPE.Text))
			{
				strErr+="证件类型。格式错误！\\n";	
			}
			if(this.txtREGISTER_NAME.Text.Trim().Length==0)
			{
				strErr+="注册姓名。不能为空！\\n";	
			}
			if(!PageValidate.IsDecimal(txtID.Text))
			{
				strErr+="原ID格式错误！\\n";	
			}

			if(strErr!="")
			{
				MessageBox.Show(this,strErr);
				return;
			}
			string PET_YEARCCK_ID=this.txtPET_YEARCCK_ID.Text;
			decimal ACCEPT_TYPE=decimal.Parse(this.txtACCEPT_TYPE.Text);
			string ACCEPT_NO=this.txtACCEPT_NO.Text;
			DateTime CHARGE_DATE=DateTime.Parse(this.txtCHARGE_DATE.Text);
			string CHARGER_ID=this.txtCHARGER_ID.Text;
			string NOTE=this.txtNOTE.Text;
			string REG_ORG_ID=this.txtREG_ORG_ID.Text;
			DateTime TAKE_DATE=DateTime.Parse(this.txtTAKE_DATE.Text);
			string TAKER_NAME=this.txtTAKER_NAME.Text;
			string CHARGE_STATE=this.txtCHARGE_STATE.Text;
			DateTime CREATE_TIME=DateTime.Parse(this.txtCREATE_TIME.Text);
			string CREATOR_ID=this.txtCREATOR_ID.Text;
			DateTime UPDATE_TIME=DateTime.Parse(this.txtUPDATE_TIME.Text);
			string UPDATOR_ID=this.txtUPDATOR_ID.Text;
			string CARD_NO=this.txtCARD_NO.Text;
			decimal CARD_TYPE=decimal.Parse(this.txtCARD_TYPE.Text);
			string REGISTER_NAME=this.txtREGISTER_NAME.Text;
			decimal ID=decimal.Parse(this.txtID.Text);

			MidSoft.Model.Model_T_PET_YEARCHK model=new MidSoft.Model.Model_T_PET_YEARCHK();
			model.PET_YEARCCK_ID=PET_YEARCCK_ID;
			model.ACCEPT_TYPE=ACCEPT_TYPE;
			model.ACCEPT_NO=ACCEPT_NO;
			model.CHARGE_DATE=CHARGE_DATE;
			model.CHARGER_ID=CHARGER_ID;
			model.NOTE=NOTE;
			model.REG_ORG_ID=REG_ORG_ID;
			model.TAKE_DATE=TAKE_DATE;
			model.TAKER_NAME=TAKER_NAME;
			model.CHARGE_STATE=CHARGE_STATE;
			model.CREATE_TIME=CREATE_TIME;
			model.CREATOR_ID=CREATOR_ID;
			model.UPDATE_TIME=UPDATE_TIME;
			model.UPDATOR_ID=UPDATOR_ID;
			model.CARD_NO=CARD_NO;
			model.CARD_TYPE=CARD_TYPE;
			model.REGISTER_NAME=REGISTER_NAME;
			model.ID=ID;

			MidSoft.BLL.BLL_T_PET_YEARCHK bll=new MidSoft.BLL.BLL_T_PET_YEARCHK();
			bll.Add(model);
			Maticsoft.Common.MessageBox.ShowAndRedirect(this,"保存成功！","add.aspx");

		}


        public void btnCancle_Click(object sender, EventArgs e)
        {
            Response.Redirect("list.aspx");
        }
    }
}
